@use 'src/components/style/foundation/mixins' as mixins;
@use 'src/components/style/foundation/typography' as typography;
@use 'src/components/style/foundation/colors' as colors;
@use 'src/components/style/foundation/spacing' as spacing;
@use 'src/components/style/foundation/media-queries' as media;

.Loader {
  text-align: center;
}

.Header {
  padding: spacing.spacing(base);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.HeaderLinks {
  margin: 0 0 spacing.spacing() 0;
  display: flex;
  flex-direction: column;
  align-items: center;

  @include media.media(media.$media-query--mobile-up) {
    flex-direction: row;
  }

  a {
    display: inline-block;
    margin: 0 0 spacing.spacing(tight) 0;
    text-align: center;

    @include media.media(media.$media-query--mobile-up) {
      margin: 0 spacing.spacing(loose) 0 0;
      display: inline;
    }
  }
}

.RefinementsWrapper {
  padding: spacing.spacing(base);
}

.CurrentRefinements {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.HitsCount {
  font-size: typography.font-size(body, smaller);
  margin: 0;
}

.LinkGroup button,
.LinkGroup a {
  margin: 0 spacing.spacing(loose) 0 0;
}

.OnlineRadios {
  margin-bottom: spacing.spacing(base);
  display: flex;

  input {
    width: auto;
  }

  label {
    margin-right: spacing.spacing(loose);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: spacing.spacing(tight) 0;
  }

  input {
    margin: 0 spacing.spacing(tight) 0 0;
  }

  @include media.media(media.$media-query--mobile--vertical) {
    flex-direction: column;

    label {
      margin-bottom: spacing.spacing(extra-tight);
    }
  }
}

.searchAndDate {
  display: flex;
  justify-content: space-between;
  gap: spacing.spacing(loose);
  align-items: flex-start;
}

.dateRangePicker {
  display: none;
  gap: spacing.spacing(tight);
  align-items: center;
  position: relative;

  @include media.media(media.$media-query--mobile-up) {
    display: flex;
  }

  input {
    height: 40px;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid colors.color(gray, light);
    border-radius: 4px;
    font-size: 14px;
    width: 140px;
    margin: 0;
    vertical-align: top;
    line-height: 1.5;
  }

  // Ensure React DatePicker wrapper aligns properly
  :global(.react-datepicker-wrapper) {
    display: block;

    input {
      width: 140px !important;
      height: 40px !important;
    }
  }

  // Dark mode styles for date picker inputs
  :global(.theme--dark) & input {
    background-color: rgb(32, 35, 39);
    border-color: transparent;
    color: white;

    &:focus {
      background-color: black;
    }
  }
}

.clearDateButton {
  background: colors.color(gray, lighter);
  border: 1px solid colors.color(gray, light);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: colors.color(gray, darker);
  margin-left: spacing.spacing(extra-tight);
  flex-shrink: 0;
  padding: 0;
  align-self: center;

  &:hover {
    background: colors.color(gray, light);
    color: colors.color(gray, darker);
  }

  &:focus {
    outline: 2px solid colors.color(accent, base);
    outline-offset: 2px;
  }

  // Dark mode styles
  :global(.theme--dark) & {
    background: colors.color(gray, darker);
    border-color: colors.color(gray, dark);
    color: colors.color(gray, lighter);

    &:hover {
      background: colors.color(gray, dark);
    }
  }
}
